/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dell
 * Date: 2023-12-10
 * Time: 12:04
 */
public class login1 {
    private static String userName = "admin";
    private static String password = "123456";
    public static void loginInfo(String userName, String password)
            throws UserNameException,PasswordException{
        if (!userName.equals(userName)) {
            throw new UserNameException("用户名错误！");
        }
        if (!password.equals(password)) {
            throw new PasswordException("用户名错误！");
        }
        System.out.println("登陆成功");
    }
    public static void main(String[] args) {
        System.out.println(1);
        try {
            loginInfo("admin", "123456");
        } catch (UserNameException e) {
            e.printStackTrace();
        } catch (PasswordException e) {
            e.printStackTrace();
        }
    }
}